import 'package:flutter/material.dart';

class MyApp16 extends StatelessWidget {
  const MyApp16({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
            appBar: AppBar(
              title: const Text('CustomScrollView'),
              backgroundColor: Colors.black26,
              centerTitle: true,
            ),
            body: CustomScrollView(
              slivers: [
                // 1.grid
                SliverGrid.builder(
                  gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
                      crossAxisCount: 3,
                      mainAxisSpacing: 10,
                      crossAxisSpacing: 10),
                  itemBuilder: (context, index) {
                    return Container(
                        color: Colors.green, child: const Text('1'));
                  },
                  itemCount: 6,
                ),
                // 2.padding
                const SliverPadding(padding: EdgeInsets.only(bottom: 50)),
                // 3.list
                SliverList(
                    delegate: SliverChildBuilderDelegate(
                  (BuildContext context, int index) {
                    return Container(
                      padding: const EdgeInsets.only(bottom: 5),
                      child: Container(
                        height: 120.0,
                        color: Colors.orange,
                        alignment: Alignment.centerLeft,
                        child: Text('传智教育 $index'),
                      ),
                    );
                  },
                  // 子元素个数
                  childCount: 10,
                ))
              ],
            )));
  }
}
